//
//  LPActivityDetailViewController.m
//  LovingPartyBuilding
//
//  Created by 刘应平 on 2017/6/6.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "LPActivityDetailViewController.h"
#import "LPShowMenuView.h"
#import "LPNewsCommentCoustomView.h"
#import "QRCodeReaderViewController.h"
#import "ZJSendMessageView.h"
#import <IQKeyboardManager.h>

#import "LPActivityDetailDetailsHeaderView.h"
/**  报道cell  */
#import "LPActivityDetailReportTableViewCell.h"
#import "LPActivityDetailReportDetailmodel.h"
/**  新闻详情  */
#import "LPWKHasCommentAndHeadLineViewController.h"
#import "LPDCDetailModel.h"
/**  报道更多  */
#import "LPActivityDetailReportListViewController.h"

/**  发布报道  */
#import "ZJIssueNewsViewController.h"



/**  交流cell  */
#import "LPActivityDetailCommiuncationTableViewCell.h"
#import "LPActivityDetailCommiuncationDetailModel.h"
#import "LPActivityDetailComiuncationListViewController.h"
/**  学习cell  */
#import "LPActivityDetailStudyTableViewCell.h"
/**  资源cell*/
#import "LPActivityResouceFileTableViewCell.h"
#import "LPActivityPastTableViewCell.h"
/**  详情cell  */
#import "LPActivityDetailInforModel.h"
#import "LPActivityDetailDetailsTableViewCell.h"
/**  动态cell  */
#import "LPACtivityDetailDynamicTableViewCell.h"
#import "ZJDyamicModel.h"
#import "ZJDynamicViewController.h"
/**  发表说说  */
#import "LPActivityDetailPublishTellViewController.h"
//视频观看
#import "StudyCoureVideoViewController.h"
/** 视频、音频cell */
#import "ZJStudyVideoTableViewCell.h"
/** 图书cell */
#import "ZJStudyBookTableViewCell.h"
#import "ZJStudyRecommendModel.h"
#import "LPActivityDetailCourseStudyViewController.h"
/**  评论列表  */
#import "LPWKNewsCommentListViewController.h"
#import "LPDCDetailModel.h"
/**  参与人数筛选  */
#import "LPJoinPersonListViewController.h"
/**  活动资源列表  */
#import "LPActDetailResouseViewController.h"
#import "LPActDetailResouceModel.h"
#import "LCustomAlertView.h"
#import "YTKKeyValueStore.h"
#import "LPWebWatchResouceViewController.h"
#import "LPSignSuccessShowView.h"
#define ACTRESOUCECELL @"actresoucecell"
#define ACTPASTCELL @"actpastcell"
#define ACTSTUDYCELL @"actstudycell"
#define ACTDYNAMICCELL @"actdynamiccell"
#define ACTREPORTCELL @"actreportcell"
@interface LPActivityDetailViewController ()<CSGrowingTextViewDelegate,ZJSendMessageViewDelegate,UITableViewDelegate,UITableViewDataSource,LPShowMenuButtonDelegate,LPNEWSCommentCoustomDelegate,LPActivityDetailReportTabelDelegate,LPActivityDetailDynamicTableDetegate,LCustomAlertDelegate,LPActivityPastTableDelegate,LPActivityResouceFileTabelDelegate,LPActivityDetailStudyTableDelegate,LPActivityDetailDetailsHeaderViewDelgate>{
    UIView *_commentBGView;/** 评论页面背景View */
    
    //    NSInteger _isfirst;
    //    NSInteger  _page;
    NSInteger _index;/**< 记录需要刷新的sectionView */
    ///判断是不是cell点击的评论 YES表示是cell NO表示是sectionView上面的评论按钮
    BOOL isComment_Cell;
    /**  判断是评论活动  */
    BOOL isComment_act;
    ///发表评论需要的数据 (是sectionView上面的评论按钮的数据)
    ZJTalkModel *commentData_Talk;
    ///发表评论需要的数据 (是点击cell的数据)
    ZJCommentList *commentData_Comment;
    NSInteger _menuButtonTag;
    /**  是否报名  */
    NSString *is_ENROLL;
    
}
/** 评论模块 */
@property (nonatomic, strong) ZJSendMessageView *sendCommentView;
/**  tableview  */
@property (strong, nonatomic) UITableView  *tableView;
/**  菜单栏  */
@property (strong, nonatomic) LPShowMenuView  *menuView;
/**  cell高度数组  */
@property (strong, nonatomic) NSMutableArray  *cellHeigts;
/**  评论输入框  */
@property (strong, nonatomic) LPNewsCommentCoustomView  *comment;
/**  报道数据  */
@property (strong, nonatomic) NSArray  *reportArray;
/**  直播数据  */
@property (strong, nonatomic) NSArray  *livingArray;
/**  交流数据  */
@property (strong, nonatomic) NSArray  *commiuncationArray;
/**  学习数据   */
@property (strong, nonatomic) NSArray  *studyArray;
/**  动态数据  */
@property (strong, nonatomic) ZJDyamicModel  *dyamicModel;
/**  动态的model数组  */
@property (strong, nonatomic) NSMutableArray  *dyamicModelArray;

/**  判断动态数据是否存在  */
@property (assign, nonatomic) BOOL  isDyamic;

/**  infor  */
@property (strong, nonatomic) LPActivityDetailInforModel  *inforModel;
/**  往期回顾数据  */
@property (strong, nonatomic) NSArray  *pastArray;
/**  活动资源数据  */
@property (strong, nonatomic) NSArray  *actResouceArray;
/**  未学课程数量  */
@property (strong, nonatomic) NSString  *NoStudyClass;


/**  三个cell高度总和  */
@property (assign, nonatomic) CGFloat  allCellHeights;
/**  第一个cell的y  */
@property (assign, nonatomic) CGFloat  secondY;
/**  前两个cell的y  */
@property (assign, nonatomic) CGFloat  threeY;
/**  前三个cell的y  */
@property (assign, nonatomic) CGFloat  fourY;


/**  jc  */
@property (strong, nonatomic) JCAlertView  *jcAlertView;
/**  资源model  */
@property (strong, nonatomic) LPActDetailResouceModel  *chooseModel;
/**  评论的w文字数据数组  */
@property (strong, nonatomic) NSArray  *commentMenusArray;
/**  评论的图片数组  */
@property (strong, nonatomic) NSArray  *commentImagesArray;

/**  所有数据  */
@property (strong, nonatomic) NSMutableArray  *allDataSouce;
/**  判断是否是第一次进来  */
@property (assign, nonatomic) BOOL   isFirst;
/**  header  */
@property (strong, nonatomic) LPActivityDetailDetailsHeaderView  *header;

@end

@implementation LPActivityDetailViewController

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
    manager.enable = NO;
    
    if (!self.isFirst) {
        [self getDataSource];
    }
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets  = NO;
    self.isFirst = YES;
    self.titlelabel.text = self.model.NAME;
    self.rightButton.hidden = NO;
    [self.rightButton setImage:[UIImage imageNamed:@"nav_icon_scan"] forState:UIControlStateNormal];
    [self getDataSource];
    [self.view bringSubviewToFront:self.navigView];
    [self addNotification];
    
    
}

/**  添加通知  */
- (void)addNotification{

    
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];/**< 键盘将要出现的通知 */
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDismiss:) name:UIKeyboardWillHideNotification object:nil];/**< 键盘将要消失的通知 */
    
   
}


- (void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

#pragma mark - 数据
- (void)getDataSource{
    __weak typeof(self) weakSelf = self;
    if (self.isFirst) {
        [YJProgressHUD showMessage:@"加载中..." duration:10 view:self.view];
    }
    NSMutableDictionary *paramer = [NSMutableDictionary dictionary];
    paramer[@"AI_ID"] = self.model.ID;
    paramer[@"USER_ID"] = ZJUSERINFORMODEL.CURRENT_USER_MODEL.ID;
    paramer[@"PHONE"] = ZJUSERINFORMODEL.ORG_ACCOUNT.MOBILE;
    paramer[@"ACCOUNTID"] = ZJUSERINFORMODEL.ORG_ACCOUNT.ID;
    [NetWorkingManager postWithUrlString:[NetWorkingURL getactmactionActIndex] Parameter:paramer Success:^(id object) {
        NetWorkModel *mdoel = [NetWorkModel yy_modelWithJSON:object];
        if ([mdoel.STATE isEqualToString:@"20000"]) {
            self.isFirst = NO;
            if ([object[@"INFO"][@"DELETED"] integerValue] == -1) {
                if (self.actBlock) {
                    self.actBlock();
                }
                [self initDeleteView];
            }
            else{
                [weakSelf zhengliData:object];
            }
        }
    } Fail:^(id object) {
        [YJProgressHUD hide];
        [LYEmptyManager showLoadFailWithView:weakSelf.tableView managerBlock:^{
            [weakSelf getDataSource];
        }];

    }];
    
}


-(void)initDeleteView{
    UIView * nullView = [[UIView alloc]initWithFrame:CGRectMake(0, LP_TopHeight, [UIScreen zj_screenWith], [UIScreen zj_screenHeight] -  LP_TopHeight)];
    nullView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:nullView];
    //删除活动图片
    UIImageView * nullImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ItemWidth * 237, ItemHeight * 376)];
    nullImageView.image = [UIImage imageNamed:@"img_activity_cancel"];
    nullImageView.center = CGPointMake([UIScreen zj_screenWith] / 2, ([UIScreen zj_screenHeight] -  LP_TopHeight) / 2);
    [nullView addSubview:nullImageView];
}


#pragma mark - 界面
- (void)layoutUI{
    [self.view addSubview:self.tableView];
    [self.view addSubview:self.menuView];
    [self.view bringSubviewToFront:self.navigView];
    [self.view addSubview:self.comment];
    
    _commentBGView = [[UIView alloc] initWithFrame:self.view.bounds];
    _commentBGView.backgroundColor = [UIColor blackColor];
    _commentBGView.alpha = 0.2;
    _commentBGView.hidden = YES;
    UITapGestureRecognizer *tapGester = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(action_tapGester:)];
    [_commentBGView addGestureRecognizer:tapGester];
    [self.view addSubview:_commentBGView];
    [self.view addSubview:self.sendCommentView];
    
    
    LPActivityDetailDetailsHeaderView *header = [[LPActivityDetailDetailsHeaderView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], 140 * [UIScreen zj_screenHScale] + self.inforModel.NAMEHEIGHT + self.inforModel.HEIGHT + 0.6 *  [UIScreen zj_screenWith]) inforModel:self.inforModel];
    header.delegate = self;
    self.tableView.tableHeaderView = header;
    self.header = header;
    
}


#pragma mark - 私有方法
/**  数据整理  */
- (void)zhengliData:(NSDictionary *)obj{
    [self.allDataSouce removeAllObjects];
    /**  活动的基础数据  */
    self.inforModel = [LPActivityDetailInforModel yy_modelWithDictionary:[obj objectForKey:@"INFO"]];
    /**  活动资源数据  */
    self.actResouceArray = [NSArray yy_modelArrayWithClass:[LPActDetailResouceModel class] json:[obj objectForKey:@"MAT_LIST"]];
    
    if (self.actResouceArray.count != 0) {
        NSDictionary *dic = @{@"biaoshi": @"活动资源", @"data": self.actResouceArray};
        [self.allDataSouce addObject:dic];
    }
        /**  往期回顾数据  */
    self.pastArray = [NSArray yy_modelArrayWithClass:[ActivityJoinDetailModel class] json:[obj objectForKey:@"HIS_LIST"]];
    NSDictionary *dic = @{@"biaoshi": @"往期回顾", @"data": self.pastArray};
    [self.allDataSouce addObject:dic];
    
    /**  学习数据  */
    self.studyArray = [NSArray yy_modelArrayWithClass:[ZJStudyRecommendModel class] json:[obj objectForKey:@"STUDY_LIST"]];
    if (self.studyArray.count != 0) {
        NSDictionary *dic = @{@"biaoshi": @"学习", @"data": self.studyArray};
        [self.allDataSouce addObject:dic];
    }
   
    if ([[obj objectForKey:@"SAY_LIST"] count] == 0) {
        self.isDyamic = YES;
    }else{
        /**  动态数据  */
        self.dyamicModel = [ZJDyamicModel new];
        self.dyamicModel.CHILDREN = [obj objectForKey:@"SAY_LIST"];
        self.dyamicModelArray = [self.dyamicModel.CHILDREN mutableCopy];
        self.isDyamic = NO;
        
    }
    NSDictionary *dynamic = @{@"biaoshi": @"动态", @"data": self.dyamicModelArray};
    [self.allDataSouce addObject:dynamic];

    
    
    /**  报道数据  */
    self.reportArray = [NSArray yy_modelArrayWithClass:[LPActivityDetailReportDetailmodel class] json:[obj objectForKey:@"NEW_LIST"]];
    NSDictionary *report = @{@"biaoshi": @"报道", @"data": self.reportArray};
    [self.allDataSouce addObject:report];

    
    NSString *IS_ENROLL;
    NSString *imageString;
    if ([[obj objectForKey:@"ENROLL_COUNT"] isEqualToString:@"0"]) {
        IS_ENROLL = @"报名";
         imageString = @"icon_baoming";
    }else{
        
        if ([[obj objectForKey:@"SIGN_COUNT"] isEqualToString:@"0"]) {
            IS_ENROLL = @"签到";
            imageString = @"icon_weiqiandao";
        }else{
            IS_ENROLL = @"已签到";
             imageString = @"icon_yiqiandao";
        }
        
        
    }
    
    self.commentMenusArray = @[IS_ENROLL,@"拍照分享"];
    self.commentImagesArray = @[imageString,@"tab_share"];
    is_ENROLL = [obj objectForKey:@"ENROLL_COUNT"];
    [self getOffSet];
    [self layoutUI];
    [self.tableView reloadData];
    
}


/**  得到偏移量  */
- (void)getOffSet{
    /**  头部高度  */
    CGFloat headHeight = 140 * [UIScreen zj_screenHScale] + self.inforModel.NAMEHEIGHT + self.inforModel.HEIGHT + 240 * [UIScreen zj_screenHScale];
    CGFloat resouceHeight = 0.0;
    /**  资源高度  */
    if (self.actResouceArray.count != 0) {
        resouceHeight = (self.actResouceArray.count + 2) * 50 * [UIScreen zj_screenHScale];
    }
    /**  往期回顾高度  */
    CGFloat pastHeight = 0.0;
    if (self.pastArray.count == 0) {
        pastHeight = 120 * [UIScreen zj_screenHScale];
    }else{
        pastHeight = 120 * [UIScreen zj_screenHScale] * self.pastArray.count + 40 * [UIScreen zj_screenHScale];
    }
    
    /**  学习高度  */
    CGFloat studyHeight = 0.0;
    for (ZJStudyRecommendModel *model in self.studyArray) {
        if ([model.COURSETYPE isEqualToString:@"4"]){//悦读会
            studyHeight += 125 * [UIScreen zj_screenHScale];//图书
        }else{
            studyHeight += 120 * [UIScreen zj_screenHScale];
            
        }
        
    }
    if (self.studyArray.count != 0) {
        studyHeight += 110 * [UIScreen zj_screenHScale];
    }
    
    
    self.secondY = headHeight + resouceHeight + pastHeight + studyHeight - 50 * [UIScreen zj_screenHScale];
   
    
    CGFloat secondCellHeight = 0.0;
    
    /**  动态cell高度  */
    if (self.isDyamic) {
        secondCellHeight =  130 * [UIScreen zj_screenHScale];
    }else{
        secondCellHeight =  110 * [UIScreen zj_screenHScale] + self.dyamicModel.dyamicCellHeight;
    }
    
    self.threeY = self.secondY + secondCellHeight;
    
    /**  报道cell高度  */
    CGFloat reportHeight = 0.0;
    if (self.isSecretary) {
        if (self.reportArray.count == 0) {
            reportHeight = 190 * [UIScreen zj_screenHScale];
        }else{
            reportHeight =  110 * [UIScreen zj_screenHScale] + self.reportArray.count * 130 * [UIScreen zj_screenHScale];
        }
    }else{
        if (self.reportArray.count == 0) {
            reportHeight =  130 * [UIScreen zj_screenHScale];
        }else{
            reportHeight = 110 * [UIScreen zj_screenHScale] + self.reportArray.count * 130 * [UIScreen zj_screenHScale];
        }
    }
    
    

    
}


/**  滑动显示  */
- (void)showMenu:(CGFloat)offset{
    if (offset > 50 * [UIScreen zj_screenHScale]) {
        [UIView animateWithDuration:0.5 animations:^{
            CGRect frame = self.menuView.frame;
            frame.origin.y = LP_TopHeight;
            self.menuView.frame = frame;
        }];
    }else{
        [UIView animateWithDuration:0.5 animations:^{
            CGRect frame = self.menuView.frame;
            frame.origin.y = 14;
            self.menuView.frame = frame;
        }];
    }
}

/**  menu的下划线移动  */
- (void)moveUnderLine:(CGFloat)offset{
    NSInteger index;
    if (offset >= 0 && offset < self.secondY ) {
        index = 0 ;
    }else if (offset >= self.secondY && offset < self.threeY){
        index = 1;
    }else{
        index = 2;
    }
    [self.menuView laoutUnderLineIndex:index];
}

#pragma mark - 监听事件

/**  点击屏幕键盘消失  */
- (void)action_tapGester:(UITabBarController *)tap{
    [self.view endEditing:YES];
}

/**  键盘处理  */
- (void)keyboardWillShow:(NSNotification *)notification {
    _commentBGView.hidden = NO;
    self.sendCommentView.hidden = NO;
    [self.view bringSubviewToFront:self.sendCommentView];
    
    CGFloat curkeyBoardHeight = [[[notification userInfo] objectForKey:@"UIKeyboardBoundsUserInfoKey"] CGRectValue].size.height;
    
    NSTimeInterval interal = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
    
    //计算 视图应该移动的位置
    __weak typeof(self) weakSelf = self;
    [UIView animateWithDuration:interal animations:^{
        
        weakSelf.sendCommentView.frame = CGRectMake(0, [UIScreen zj_screenHeight] - weakSelf.sendCommentView.height - curkeyBoardHeight, [UIScreen zj_screenWith], weakSelf.sendCommentView.height);
    }];
}

- (void)keyboardWillDismiss:(NSNotification *)notification {
    _commentBGView.hidden = YES;
    self.sendCommentView.hidden = YES;
    NSTimeInterval interal = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
    //计算 视图应该移动的位置
    __weak typeof(self) weakSelf = self;
    [UIView animateWithDuration:interal animations:^{
        weakSelf.sendCommentView.frame = CGRectMake(0, [UIScreen zj_screenHeight], [UIScreen zj_screenWith], weakSelf.sendCommentView.height);
        
    }];
}

- (void)action_rightButton:(UIButton *)sender{
    if ([self.inforModel.IS_END isEqualToString:@"3"]) {
        [YJProgressHUD showSuccess:@"活动已结束" inview:self.view];
        return;
    }
    
    if ([is_ENROLL integerValue] == 0) {
        [YJProgressHUD showSuccess:@"请先报名" inview:self.view];
        return;
    }
    
    /** 二维码扫描  */
    QRCodeReaderViewController *reader = [QRCodeReaderViewController new];
    
    reader.push = NO;
    reader.modalPresentationStyle = UIModalPresentationFormSheet;
    [reader setCompletionWithBlock:^(NSString *resultAsString) {
        
    } login:^(BOOL successOrFail) {
        
    } sign:^(NSDictionary *successOrFail) {
        if ([successOrFail[@"STATE"] isEqualToString:@"20000"]) {
            [self.comment.signButton setImage:[UIImage imageNamed:@"icon_yiqiandao"] forState:UIControlStateNormal];
            LPSignSuccessShowView *sign = [[LPSignSuccessShowView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], [UIScreen zj_screenHeight])];
            NSString *point = successOrFail[@"growUp"][@"point"];
            sign.data = @[point];
            if ([point integerValue] != 0) {
                [[UIApplication sharedApplication].keyWindow addSubview:sign];
            }
            
            
        }
    }];
    
    [self.navigationController pushViewController:reader animated:YES];
    
}

#pragma mark - LPActivityDetailDetailsHeaderViewDelgate
- (void)LPActivityDetailDetailsHeaderViewTap_canYu_tapIndex:(NSInteger)index{
    /**  先判断是否是书记,再判断在册用户的UNITID和活动的UNITID是否一致  */
    if (ZJUSERINFORMODEL.isSecretary == NO || !ZJUSERINFORMODEL.DEPT_MODEL_BOOK || ![self.inforModel.UNITID isEqualToString:ZJUSERINFORMODEL.DEPT_MODEL_BOOK.ID]) {
        return;
    }
    LPJoinPersonListViewController *vc = [LPJoinPersonListViewController new];
    vc.model = self.model;
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - LPShowMenuButtonDelegate,点击菜单，改变offset
- (void)LPShowMenuWithView:(LPShowMenuView *)view buttonIndex:(NSInteger)index{
    CGFloat heigth = 0.0 ;
    
    if (index == 0) {
        heigth = 0 ;
    }
    
    if(index == 1) {
        heigth = self.secondY + 1;

    }
    
    if (index == 2) {
        heigth = self.threeY + 1;

    }

    [self.tableView setContentOffset:CGPointMake(0, heigth) animated:YES];
    
}

#pragma mark - CSGrowingTextViewDelegate 协议方法
- (void)growingTextView:(CSGrowingTextView *)growingTextView willChangeHeight:(CGFloat)height{
    height = height > 34 ? height :34;
    
    CGFloat viewHeight = height + 15;
    self.sendCommentView.frame = CGRectMake(self.sendCommentView.x, self.sendCommentView.bottom - viewHeight , self.sendCommentView.width, viewHeight);
}
- (BOOL)growingTextView:(CSGrowingTextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
    NSString * toBeString = [textView.internalTextView.text stringByReplacingCharactersInRange:range withString:text];
    
    if (toBeString.length >= 200 && range.length!= 1 ){
        textView.internalTextView.text = [toBeString substringToIndex:200];
        return NO;
    }
    return YES;
}

#pragma mark - ZJSendMessageViewDelegate 协议方法
//发送评论
- (void)sendMessageWithView:(ZJSendMessageView *)view message:(NSString *)message{
    __weak typeof(self) weakSelf = self;
    if (isComment_act) {
        NetWorkUpLoadModel *loadModel = [NetWorkUpLoadModel new];
        loadModel.UPLOAD_FILES = @[];
        loadModel.ACCOUNTID = ZJUSERINFORMODEL.ORG_ACCOUNT.ID;
        loadModel.ACT_ID = self.model.ID;
        loadModel.CONTENT = self.sendCommentView.growingTextView.internalTextView.text;
         [YJProgressHUD showMessage:@"评论中..." duration:10 view:self.view];
        [NetWorkingManager uploadingWithXMLString:[NetWorkingURL getactmactionPublishChat] Parameter:loadModel Success:^(id object) {
            if ([object[@"STATE"] isEqualToString:@"20000"]) {
                [YJProgressHUD showMessage:@"评论成功" inView:weakSelf.view];
                [weakSelf getDataSource];
                
            }else{
                [YJProgressHUD showMessage:@"评论失败" inView:weakSelf.view];
            }
        } Fail:^(id object) {
            
        }];
    }else{
        [self netWorking_comment];
    }
    [self.view endEditing:YES];
    
}

//请求某个说说数据接口
- (void)netWorking_nolyChat_index:(NSInteger)index{
    __weak typeof(self) weakSelf = self;
    NSArray *dataArray = self.dyamicModel.CHILDREN_MODEL;
    ZJTalkModel *model = dataArray[index];
    NSDictionary *dict = @{@"PID":model.ID};
    [NetWorkingManager postWithUrlString:[NetWorkingURL getOnlyList] Parameter:dict Success:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {
            ZJDyamicModel *dyamicModel = [ZJDyamicModel yy_modelWithJSON:object];
            weakSelf.threeY = weakSelf.threeY - weakSelf.dyamicModel.dyamicCellHeight;
            weakSelf.dyamicModelArray[index] = dyamicModel.CHILDREN[0];
            weakSelf.dyamicModel.CHILDREN = weakSelf.dyamicModelArray;
            weakSelf.threeY = weakSelf.threeY + weakSelf.dyamicModel.dyamicCellHeight;
            
            NSInteger index;
            if (weakSelf.actResouceArray.count != 0 && weakSelf.studyArray.count == 0) {
                index = 2;
            }else if (weakSelf.actResouceArray.count == 0 && weakSelf.studyArray.count != 0){
                index = 2;
            }else if(weakSelf.actResouceArray.count != 0 && weakSelf.studyArray.count != 0){
            
                index = 3;
            }else{
                index = 1;
            }
            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0];
            
            [weakSelf.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
        }
    } Fail:^(id object) {
        
    }];
    
}
///评论的网络请求
- (void)netWorking_comment{
     [YJProgressHUD showMessage:@"评论中..." duration:10 view:self.view];
    NSString *FID;
    NSString *CHAT_ID;
    if (isComment_Cell) {//点击cell
        FID = commentData_Comment.ACTCON_ID;
        CHAT_ID = commentData_Comment.PID;
    }else{//点击sectionView
        
        FID = @"0";
        CHAT_ID = commentData_Talk.PID;
    }
    
    NSDictionary *dict = @{
                           @"FID":FID,
                           @"CHAT_ID":CHAT_ID,
                           @"USERID":ZJUSERINFORMODEL.ORG_ACCOUNT.ID,
                           @"CONTENT":self.sendCommentView.growingTextView.internalTextView.text,
                           };
    __weak typeof(self) weakSelf = self;
    [NetWorkingManager postWithUrlString:[NetWorkingURL addCommintDymaic] Parameter:dict Success:^(id object) {
        
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {//成功
            [YJProgressHUD showMsgWithoutView:@"评论成功"];
            
            [weakSelf netWorking_nolyChat_index:_index];
        }else{
            [YJProgressHUD showMsgWithoutView:@"评论失败"];
            
        }
    } Fail:^(id object) {
        [YJProgressHUD showMsgWithoutView:@"评论失败"];
    }];
}


- (void)LPNEWSCommentCoustomViewDelegate_commentTextButtonClick{
    LPWKNewsCommentListViewController *vc = [LPWKNewsCommentListViewController new];
    LPDCDetailModel *model = [LPDCDetailModel new];
    model.ID = self.model.ID;
    vc.model = model;
    vc.titleString = @"讨论列表";
    vc.isNoNews = YES;
    [self.navigationController pushViewController:vc animated:YES];
    
    
}

- (void)lpActivityDetailDynamicWithCell:(LPACtivityDetailDynamicTableViewCell *)cell sectionIndex:(NSInteger)index sectionCommentTalk:(ZJTalkModel *)talkModel{
    self.sendCommentView.growingTextView.placeholderLabel.text = @"发表评论";
    _index = index;
    commentData_Talk = talkModel;
    isComment_Cell = NO;
    [self.sendCommentView.growingTextView.internalTextView becomeFirstResponder];
}


- (void)lpActivityDetailDynamicWithCell:(LPACtivityDetailDynamicTableViewCell *)cell cellIndex:(NSInteger)index cellCommentData:(ZJCommentList *)cellCommentData{
    
    isComment_Cell = YES;
    _index = index;
    commentData_Comment = cellCommentData;
    if ([commentData_Comment.USERID isEqualToString:ZJUSERINFORMODEL.ORG_ACCOUNT.ID]) {
        [YJProgressHUD showMessage:@"不能评论自己" inView:self.view];
        return;
    }
    self.sendCommentView.growingTextView.placeholderLabel.text = [NSString stringWithFormat:@"回复%@...",cellCommentData.UNAME];
    [self.sendCommentView.growingTextView.internalTextView becomeFirstResponder];
    
}


#pragma mark - 动态cell的协议代理
- (void)lpActivityDetailDynamicWithCell:(LPACtivityDetailDynamicTableViewCell *)cell watchMore:(BOOL)more{
    ZJDynamicViewController *vc = [ZJDynamicViewController new];
    vc.model = self.model;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)lpActivityDetailDynamicWithCell:(LPACtivityDetailDynamicTableViewCell *)cell spot:(BOOL)isSpot index:(NSInteger)index{
    [self netWorking_nolyChat_index:index];
    
}

- (void)lpActivityDetailDynamicWithCell:(LPACtivityDetailDynamicTableViewCell *)cell DeleteIndex:(NSInteger)index{
    self.threeY = self.threeY - self.dyamicModel.dyamicCellHeight;
    [self.dyamicModelArray removeObjectAtIndex:index];
    self.dyamicModel.CHILDREN = self.dyamicModelArray;
    self.threeY = self.threeY + self.dyamicModel.dyamicCellHeight;
    
    NSInteger index1;
    if (self.actResouceArray.count != 0 && self.studyArray.count == 0) {
        index1 = 2;
    }else if (self.actResouceArray.count == 0 && self.studyArray.count != 0){
        index1 = 2;
    }else if(self.actResouceArray.count != 0 && self.studyArray.count != 0){
        
        index1 = 3;
    }else{
        index1 = 1;
    }
    if (self.dyamicModel.CHILDREN.count == 0) {
        self.isDyamic = YES;
    }
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index1 inSection:0];
    
    [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];

}

#pragma mark - LPNEWSCommentCoustomDelegate
- (void)LPNEWSCommentCoustomWithView:(LPNewsCommentCoustomView *)view commentButtonClick:(NSInteger)buttonTag{
    __weak typeof(self) weakSelf = self;
//     if (buttonTag == 0){
//         LPActivityDetailComiuncationListViewController *vc = [LPActivityDetailComiuncationListViewController new];
//         vc.model = self.model;
//         [self.navigationController pushViewController:vc animated:YES];
//        
//    }else
    
        
    if(buttonTag == 0){
        if ([self.inforModel.IS_END isEqualToString:@"3"]) {
            [YJProgressHUD showSuccess:@"活动已结束" inview:self.view];
            return;
        }
        
        if ([view.signButton.titleLabel.text isEqualToString:@"报名"]) {
            [YJProgressHUD showMessage:@"报名中..." duration:10 view:self.view];
            /**  这是报名  */
            NSDictionary *paramer = @{@"AI_ID": self.inforModel.ID,
                                      @"USER_ID": ZJUSERINFORMODEL.CURRENT_USER_MODEL.ID,
                                      @"USER_NAME": ZJUSERINFORMODEL.ORG_ACCOUNT.USER_NAME};
            [NetWorkingManager postWithUrlString:[NetWorkingURL getactactionMobileEnroll] Parameter:paramer Success:^(id object) {
                NSString *CODE = [object objectForKey:@"CODE"];
                if ([CODE isEqualToString:@"20000"]) {
                    [MobClick event:[UMMStatisticsString registerAct]];
                    is_ENROLL = @"1";
                    [YJProgressHUD showSuccess:@"报名成功" inview:weakSelf.view];
                    self.header.addNumber = YES;
                    [view.signButton  setTitle:@"签到" forState:UIControlStateNormal];
                    [view.signButton setImage:[UIImage imageNamed:@"icon_weiqiandao"] forState:UIControlStateNormal];
                    if (weakSelf.block) {
                        weakSelf.block();
                    }
                    /**  报名成功修改数据源刷新界面  */
                }else if ([CODE isEqualToString:@"80001"]) {
                    [YJProgressHUD showSuccess:@"重复报名" inview:weakSelf.view];
                }else if ([CODE isEqualToString:@"80002"]) {
                    [YJProgressHUD showSuccess:@"活动结束" inview:weakSelf.view];
                }else if ([CODE isEqualToString:@"80003"]) {
                    [YJProgressHUD showSuccess:@"活动人数已达上限" inview:weakSelf.view];
                }else if ([CODE isEqualToString:@"80004"]) {
                    [YJProgressHUD showSuccess:@"无此活动或活动已被删除" inview:weakSelf.view];
                }else{
                    [YJProgressHUD showSuccess:@"报名失败" inview:weakSelf.view];
                }
                
            } Fail:^(id object) {
                [YJProgressHUD showSuccess:@"报名失败" inview:weakSelf.view];
            }];
        }else if([view.signButton.titleLabel.text isEqualToString:@"签到"]){
            /**  这是签到  */
            
            QRCodeReaderViewController *reader = [QRCodeReaderViewController new];
            
            reader.push = NO;
            reader.modalPresentationStyle = UIModalPresentationFormSheet;
            [reader setCompletionWithBlock:^(NSString *resultAsString) {
                
            } login:^(BOOL successOrFail) {
                
            } sign:^(NSDictionary *successOrFail) {
                if ([successOrFail[@"STATE"] isEqualToString:@"20000"]) {
                    [view.signButton  setTitle:@"已签到" forState:UIControlStateNormal];
                    [view.signButton setImage:[UIImage imageNamed:@"icon_yiqiandao"] forState:UIControlStateNormal];
                    if (weakSelf.block) {
                        weakSelf.block();
                    }
                    LPSignSuccessShowView *sign = [[LPSignSuccessShowView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], [UIScreen zj_screenHeight])];
                    NSString *point = successOrFail[@"growUp"][@"point"];
                    sign.data = @[point];
                    if ([point integerValue] != 0) {
                        [[UIApplication sharedApplication].keyWindow addSubview:sign];
                    }
                    
                }
                
            }];
            
            [self.navigationController pushViewController:reader animated:YES];
        }
        
        
    }else{
        /**  跳转上传活动圈  */
        LPActivityDetailPublishTellViewController *vc = [LPActivityDetailPublishTellViewController new];
        vc.model = self.model;
        [self.navigationController pushViewController:vc animated:YES];
    }
}


#pragma mark - LPActivityResouceFileTabelDelegate
/**  活动资源  */
- (void)LPActivityResouceFileTabelWithCell_index:(NSInteger)index{
    LPActDetailResouceModel *model = self.actResouceArray[index];
    self.chooseModel = model;
    /**  获取本地文件路径  */
    NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];
    /**  创建表  */
    YTKKeyValueStore *store = [[YTKKeyValueStore alloc] initDBWithName:RESOUCESURFACE];
    [store createTableWithName:RESOUCE_TABLE];
    
    /**  获取文件后缀  */
    NSArray *stringArray = [NSString getArrayFromString:model.FILE_PATH byString:@"."];
    //获取保存数据
    NSArray *downArray = [store getObjectById:ZJUSERINFORMODEL.ORG_ACCOUNT.ID fromTable:RESOUCE_TABLE];
    /**  创建目录  */
    NSString *testDirectory = [documentsDirectory stringByAppendingString:@"/downResoucee"];
    /**  通过ID得到唯一标识  */
    NSString *testString = [NSString stringWithFormat:@"/%@.%@",model.ID,stringArray.lastObject];
    //  创建文件
    NSString *testPath = [testDirectory stringByAppendingPathComponent:testString];
    NSInteger flog = 0;
    NSDictionary *resouceDic;
    for (NSDictionary *dic  in downArray) {
        if ([dic[@"resouce"] isEqualToString:testString]) {
            flog = 1;
            resouceDic = dic;
        }
    }
    
    if (flog == 1) {
        /**  从本地判断，存在直接观看  */
        LPWebWatchResouceViewController *vc = [LPWebWatchResouceViewController new];
        vc.headLine = model.NAME;
        vc.urlString = testPath;
        [self.navigationController pushViewController:vc animated:YES];
    }else{
        /**  不存在就弹出下载  */
        [self downAlertView];
        
    }


}

- (void)downAlertView{
    LCustomAlertView *alert = [[LCustomAlertView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height) alertMessage:@"下载才能查看,是否下载" titlesArray:@[@"取消", @"确认"]];
    alert.delegate = self;
    self.jcAlertView = [[JCAlertView alloc] initWithCustomView:alert dismissWhenTouchedBackground:YES];
    [self.jcAlertView show];
    
}

#pragma mark - LCustomAlertDelegate
- (void)lCustomAlertWithView:(LCustomAlertView *)view index:(NSInteger)index{
    if (index == 1) {
         [YJProgressHUD show:@"下载中..." inView:self.view mode:YJProgressModeLoading];
        /**  创建表  */
        YTKKeyValueStore *store = [[YTKKeyValueStore alloc] initDBWithName:RESOUCESURFACE];
        [store createTableWithName:RESOUCE_TABLE];
        //获取保存数据
        NSArray *downArray = [store getObjectById:ZJUSERINFORMODEL.ORG_ACCOUNT.ID fromTable:RESOUCE_TABLE];
        
        /**  获取本地文件路径  */
        NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];
        /**  获取文件后缀  */
        NSArray *stringArray = [NSString getArrayFromString:self.chooseModel.FILE_PATH byString:@"."];
        /**  创建目录  */
        NSString *testDirectory = [documentsDirectory stringByAppendingString:@"/downResoucee"];
        /**  通过ID得到唯一标识  */
        NSString *testString = [NSString stringWithFormat:@"/%@.%@",self.chooseModel.ID,stringArray.lastObject];
        //  创建文件
        NSString *testPath = [testDirectory stringByAppendingPathComponent:testString];
        
        
        
        NSString *urlstring = [NSString stringWithFormat:@"%@/%@",DOWNFILE,self.chooseModel.FILE_PATH];
        urlstring = [urlstring stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *url = [NSURL URLWithString:urlstring];
        //创建请求
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
        //方法二：发送一个异步请求
        [NSURLConnection sendAsynchronousRequest:request
                                           queue:[NSOperationQueue mainQueue]
                               completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
                                   [YJProgressHUD hide];
                                   if (!connectionError) {
                                       NSData *doubi = data;
                                       NSMutableArray *allArray = [NSMutableArray array];
                                       [allArray addObjectsFromArray:downArray];
                                       //  二进制流写入文件
                                       NSFileManager *fileManger = [NSFileManager defaultManager];
                                       //  创建目录
                                       [fileManger createDirectoryAtPath:testDirectory withIntermediateDirectories:YES attributes:nil error:nil];
                                       
                                       //  写入文件
                                       [fileManger createFileAtPath:testPath contents:doubi attributes:nil];
                                       
                                       /**  整合数据  */
                                       NSDictionary *dataDic = @{@"resouce": testString};
                                       [allArray addObject:dataDic];
                                       
                                       [store putObject:allArray withId:ZJUSERINFORMODEL.ORG_ACCOUNT.ID intoTable:RESOUCE_TABLE];
                                       
                                       LPWebWatchResouceViewController *vc = [LPWebWatchResouceViewController new];
                                       vc.headLine = self.chooseModel.NAME;
                                       vc.urlString = testPath;
                                       [self.navigationController pushViewController:vc animated:YES];
                                       
                                       
                                       
                                   } else {
                                       [YJProgressHUD showMsgWithoutView:@"下载失败"];
                                       
                                   }
                               }];
    }
    [self.jcAlertView dismissWithCompletion:nil];
}


- (void)LPActivityResouceFileTabelWithCell_watchMore:(BOOL)more{
    LPActDetailResouseViewController *vc
    = [LPActDetailResouseViewController new];
    vc.model = self.model;
    [self.navigationController pushViewController:vc animated:YES];

}

#pragma mark - LPActivityPastTableDelegate
/**  往期回顾  */
- (void)LPActivityPastTable_clickindex:(NSInteger)index{
    LPActivityDetailViewController *vc = [LPActivityDetailViewController new];
    vc.model = self.pastArray[index];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - LPActivityDetailStudyTableDelegate
/**  这是学习  */
- (void)LPActivityDetailStudyTableWithCell:(LPActivityDetailStudyTableViewCell *)cell index:(NSInteger)index{
    StudyCoureVideoViewController *vc = [StudyCoureVideoViewController new];
    vc.model = self.studyArray[index];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)LPActivityDetailStudyTableWithCell:(LPActivityDetailStudyTableViewCell *)cell watchMore:(BOOL)watchmore{
    LPActivityDetailCourseStudyViewController *vc = [LPActivityDetailCourseStudyViewController new];
    vc.model = self.model;
    vc.isSeeMore = YES;
    [self.navigationController pushViewController:vc animated:YES];

}





#pragma mark - LPActivityDetailReportTabelDelegate
- (void)LPActivityDetailReportTabelWithCell:(LPActivityDetailReportTableViewCell *)cell index:(NSInteger)index{
    LPActivityDetailReportDetailmodel *model = self.reportArray[index];
    LPDCDetailModel *act = [LPDCDetailModel new];
    act.ID = model.ID;
    act.TITLE = model.TITLE;
    act.URL = model.URL;
    LPWKHasCommentAndHeadLineViewController *vc = [LPWKHasCommentAndHeadLineViewController new];
    vc.model = act;
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)LPActivityDetailReportTabelWithCell:(LPActivityDetailReportTableViewCell *)cell watchMore_index:(NSInteger)watchmore{
    ZJIssueNewsViewController *fabu = [ZJIssueNewsViewController new];
    fabu.ID = self.model.ID;
    /**  报道的查看更多  */
    LPActivityDetailReportListViewController *baodao = [LPActivityDetailReportListViewController new];
    baodao.model = self.model;
    
    if (self.reportArray.count == 0 ) {
        if (self.isSecretary) {
        [self.navigationController pushViewController:fabu animated:YES];
        }
    }else{
        if (self.isSecretary) {
            if (watchmore == 0) {
                [self.navigationController pushViewController:fabu animated:YES];
            }else{
               
                [self.navigationController pushViewController:baodao animated:YES];
            }
        }else{
            [self.navigationController pushViewController:baodao animated:YES];
        }
    
    }
    
}

#pragma mark - UITableViewDataSource,UITableViewDelegate
/**  返回组个数  */
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
/**  返回cell个数  */
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.allDataSouce.count;
}
/**  返回cell高度  */
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *biaoshi = [self.allDataSouce[indexPath.row] objectForKey:@"biaoshi"];
    NSArray *data = [self.allDataSouce[indexPath.row] objectForKey:@"data"];
    if ([biaoshi isEqualToString:@"活动资源"]) {
        return data.count * 50 * [UIScreen zj_screenHScale] + 100 * [UIScreen zj_screenHScale];
    }else if ([biaoshi isEqualToString:@"往期回顾"]) {
        if (data.count == 0) {
            return 120 * [UIScreen zj_screenHScale];
        }else{
            return data.count * 120 * [UIScreen zj_screenHScale] + 40 * [UIScreen zj_screenHScale];
        }
        
    }else if ([biaoshi isEqualToString:@"学习"]) {
        CGFloat height = 0.0;
        for (ZJStudyRecommendModel *model in data) {
            if ([model.COURSETYPE isEqualToString:@"4"]){//悦读会
                height += 125 * [UIScreen zj_screenHScale];//图书
            }else{
                height += 120 * [UIScreen zj_screenHScale]; //视频、音频
            }
            
        }

        return height + 110 * [UIScreen zj_screenHScale];
    }else if ([biaoshi isEqualToString:@"动态"]) {
        /**  动态  */
        if (self.isDyamic) {
            return 130 * [UIScreen zj_screenHScale];
        }else{
            return 110 * [UIScreen zj_screenHScale] + self.dyamicModel.dyamicCellHeight;
        }
    }else{
        if (self.isSecretary) {
            if (self.reportArray.count == 0) {
                return 190 * [UIScreen zj_screenHScale];
            }else{
                return 110 * [UIScreen zj_screenHScale] + self.reportArray.count * 130 * [UIScreen zj_screenHScale];
            }
        }else{
            if (self.reportArray.count == 0) {
                return 130 * [UIScreen zj_screenHScale];
            }else{
                return 110 * [UIScreen zj_screenHScale] + self.reportArray.count * 130 * [UIScreen zj_screenHScale];
            }
        }
        
        
    }
    
    
}
/**  cell初始化  */
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *biaoshi = [self.allDataSouce[indexPath.row] objectForKey:@"biaoshi"];
    NSArray *data = [self.allDataSouce[indexPath.row] objectForKey:@"data"];
    if ([biaoshi isEqualToString:@"活动资源"]) {
        LPActivityResouceFileTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ACTRESOUCECELL forIndexPath:indexPath];
        cell.dataArray = data;
        cell.delegate = self;
        return cell;
    }else if ([biaoshi isEqualToString:@"往期回顾"]){
        LPActivityPastTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ACTPASTCELL forIndexPath:indexPath];
        cell.dataArray = data;
        cell.delegate = self;
        return cell;
    }else if ([biaoshi isEqualToString:@"学习"]){
        LPActivityDetailStudyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ACTSTUDYCELL forIndexPath:indexPath];
        cell.modelArray = data;
        cell.delegate = self;
        return cell;
    }else if ([biaoshi isEqualToString:@"动态"]){
        LPACtivityDetailDynamicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ACTDYNAMICCELL forIndexPath:indexPath];
        cell.isDyamic = self.isDyamic;
        cell.model = self.dyamicModel;
        cell.delegate = self;
        return cell;

    }else{
        LPActivityDetailReportTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ACTREPORTCELL forIndexPath:indexPath];
        cell.isSecretary = self.isSecretary;
        cell.modelArray = data;
        cell.delegate = self;
        return cell;
    
    }

    
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    CGFloat offset = scrollView.contentOffset.y;
    [self showMenu:offset];
    [self moveUnderLine:offset];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.00000001;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.00000001;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}
#pragma mark - 懒加载
/**  初始化tableView  */
- (UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, LP_TopHeight, self.view.bounds.size.width, self.view.bounds.size.height - 49 - LP_TopHeight) style:UITableViewStyleGrouped];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        _tableView.separatorColor = [UIColor clearColor];
        _tableView.tableFooterView = [UIView new];
        [_tableView registerClass:[LPActivityResouceFileTableViewCell class] forCellReuseIdentifier:ACTRESOUCECELL];
         [_tableView registerClass:[LPActivityPastTableViewCell class] forCellReuseIdentifier:ACTPASTCELL];
         [_tableView registerClass:[LPActivityDetailStudyTableViewCell class] forCellReuseIdentifier:ACTSTUDYCELL];
         [_tableView registerClass:[LPACtivityDetailDynamicTableViewCell class] forCellReuseIdentifier:ACTDYNAMICCELL];
         [_tableView registerClass:[LPActivityDetailReportTableViewCell class] forCellReuseIdentifier:ACTREPORTCELL];
    }
    return _tableView;
}

- (LPShowMenuView *)menuView{
    if (_menuView == nil) {
        _menuView = [[LPShowMenuView alloc] initWithFrame:CGRectMake(0, 14, self.view.width, 50 * [UIScreen zj_screenHScale])];
        _menuView.delegate = self;
    }
    return _menuView;
    
}

- (NSMutableArray *)cellHeigts{
    if (!_cellHeigts) {
        _cellHeigts = [NSMutableArray array];
    }
    return _cellHeigts;
}

- (LPNewsCommentCoustomView *)comment{
    if (_comment == nil) {
        _comment = [[LPNewsCommentCoustomView alloc] initWithFrame:CGRectMake(0, self.view.height - 49, self.view.width, 49) titles:self.commentMenusArray images:self.commentImagesArray];
        _comment.commentTextString = @"期待您的讨论";
        _comment.delegate = self;
    }
    return _comment;
}

- (ZJSendMessageView *)sendCommentView{
    if (_sendCommentView == nil){
        _sendCommentView = [[ZJSendMessageView alloc]init];
        _sendCommentView.frame = CGRectMake(0, [UIScreen zj_screenHeight], [UIScreen zj_screenWith], 49);
        _sendCommentView.delegate = self;
        _sendCommentView.growingTextView.placeholderLabel.text = @"发表评论...";
    }
    return _sendCommentView;
}
- (NSMutableArray *)dyamicModelArray{
    if (!_dyamicModelArray) {
        _dyamicModelArray = [NSMutableArray array];
    }
    return _dyamicModelArray;
}

- (LPActDetailResouceModel *)chooseModel{
    if (!_chooseModel) {
        _chooseModel = [LPActDetailResouceModel new];
    }
    return _chooseModel;
}

- (NSMutableArray *)allDataSouce{
    if (!_allDataSouce) {
        _allDataSouce = [NSMutableArray array];
    }
    return _allDataSouce;
}
@end
